/**
 * @properties={typeid:35,uuid:"93EFCD74-9ABA-4043-B0EF-0E9A625DD372",variableType:6}
 */
var fImporte = 0;

/**
 * @properties={typeid:35,uuid:"4E04F7DB-4025-49D3-8FD2-6A926FB50191"}
 */
var fObservaciones = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"DFF7F177-622D-41F6-B2C8-E42FA6619CD9"}
 */
function cancelar(event) {
	application.closeForm('PAGA_SALDO')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2E67CA75-7070-4A2E-ADF8-F55E9F6AEA13"}
 */
function aceptar(event) {
	if (fImporte > saldo_mov)
	{
		globals.gDialog('Aviso','El importe ingresado es mayor al saldo','OK')
		return
	}
	var fs = databaseManager.getFoundSet('medicos','cuenta_corriente')
	
	fs.newRecord()
	fs.fecha_pago			= new Date()        
	fs.fecha_turno_origen	= fecha_turno_origen
	fs.grupo_id             = grupo_id          
	fs.importe              = fImporte           
	fs.marca_orden          = 0       
	fs.medico_id            = medico_id         
	fs.observaciones        = fObservaciones     
	fs.orden                = orden             
	fs.paciente_id          = paciente_id       
	fs.saldo_mov            = 0        
	fs.tipo_movim           = 2 // Cobranza
	
	saldo_mov -= fImporte
	application.closeForm('PAGA_SALDO')
}
